function checkLoggedIn() {
    var user = JSON.parse(localStorage.getItem("loggedinUser"));
    //If no one is logged in we send an alert and go to login.html
    if (!user) {
        alert("You must log in to see this page.");
        window.location.href = "../login.html";
    }
}
checkLoggedIn();